<?php

/*
 * 清理类
 * Author: DuZhenxun <5552123@qq.com>
 * @ 2014年12月29日 11:10:59
 */

class CacheAction extends CommonAction {

    public function clear_file() {
        $dir = dirname(__FILE__).'/../../Runtime/';
        

         
        if(dir_delete($dir)){
            @mkdir($dir,0777);
        }
        


        $this->display();
    }

    public function clear_mem() {
        c_cache('Memcache')->clear();
        $this->success('清理完毕');
    }

    public function list_mem() {
        $data =  mem_all(C('Memcache.host'),false);
        foreach($data as $k=>$v){
            $sort[$k] = $v['settime'];
        }
        array_multisort($sort,SORT_DESC,$data);
        $count = count($data);
        $this->assign('count', $count);
        //p($data);
        $data = array_slice($data, 0,50);
        $this->assign('data',$data);
       
        
        $this->display();
    }

   

}
